/*
 * SimpleModal Basic Modal Dialog
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2010 Eric Martin - http://ericmmartin.com
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Revision: $Id: basic.js 254 2010-07-23 05:14:44Z emartin24 $
 */

$(function ($) {
	$('.basic').click(function () {
		$("#results").slideUp("slow");
		$('#basic-modal-content').modal();
		return false;
	});		
})

function create_message_div(){
	var newDiv = document.createElement("div");
	newDiv.id = "flash_alert";
	newDiv.innerHTML="<span class='flash_message'></span>";
	//var newSpan = document.createElement("span");
	//newSpan.class="flash_message";
	//newDiv.appendChild(newSpan);
	
	document.getElementById("main").appendChild(newDiv);
}

function flash_success_message(val){
	create_message_div();
	$("#flash_alert").addClass("success");	
	flash_message(val);
}

function flash_error_message(val){
	create_message_div();
 	$("#flash_alert").addClass("error");
	flash_message(val);
}

function flash_message(val){
	$("#flash_alert").show();
 	$(".flash_message").text(val);
 	setTimeout(function(){
 		flash_alert_clear();
 	},1500);
}

function flash_alert_clear(){
	var options = { direction: "up" };
	$("#flash_alert").hide();
	$("#flash_alert").detach();	
	$(".ui-effects-wrapper").detach();	
}

